export default {
  namespaced: true,
  state: {
    token: '',
    userinfo: {},
    hrsaasTime: 0
  },
  mutations: {
    GET_TOKEN(state, token) {
      state.token = token
    },
    REMOVE_TOKEN(state) {
      state.token = null
    },
    GET_USERINFO(state, userinfo) {
      state.userinfo = userinfo
    },
    REMOVE_USERINFO(state) {
      state.userinfo = ''
    },
    SETHRSAASTIME(state, time) {
      state.hrsaasTime = time
    }
  },
  actions: {
    logout({ commit }) {
      commit('REMOVE_TOKEN')
      commit('REMOVE_USERINFO')
      commit('SETHRSAASTIME', Date.now())
    }
  }
}
